{extend name="admin@public/base_content" /}
{block name="body">}
<body>
{include file="admin@public/common" /}
<div class="container-fluid larry-wrapper">
    <div class="row">
        <div class="col-xs-12 col-sm-12 col-md-12">
            <section class="panel panel-padding">
                <form id="form1" class="layui-form layui-form-pane" action="{:url('')}">

                    <div class="layui-form-item">
                        <label class="layui-form-label">名称</label>
                        <div class="layui-input-block">
                            <input type="text" name="name" value="{$info.name|default=''}" jq-verify="required" jq-error=" 请输入名称" placeholder="请输入名称" class="layui-input ">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">字段名</label>
                        <div class="layui-input-block">
                            <input type="text" name="field" value="{$info.field|default=''}" required jq-verify="required|field" jq-error="请输入字段名" placeholder="请输入字段名" class="layui-input ">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">字段类型</label>
                        <div class="layui-input-inline">
                            <select class="tpl-form-input" name="type">
                                <option value="">请选择</option>
                                {foreach name="typeField" item="vo"}
                                <option value="{$key}" {if condition="($info.type eq $key) or (empty($info.type) && ($key eq '1'))"}selected{/if}>{$vo.name}（{$propertyField[$vo.property]['name']}）</option>
                                {/foreach}
                            </select>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">字段提示</label>
                        <div class="layui-input-block">
                            <input type="text" name="tip" value="{$info.tip|default=''}" jq-verify="" jq-error=" 请输入字段提示" placeholder="请输入字段提示" class="layui-input ">
                        </div>
                    </div>
                    <div class="layui-form-item ">
                        <label class="layui-form-label">字段配置</label>
                        <div class="layui-input-block">
                            <textarea name="config" placeholder="如果为选择或下拉等类型时多个项目名用逗号分隔开" class="layui-textarea">{$info.config|default=''}</textarea>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">默认值</label>
                        <div class="layui-input-block">
                            <input type="text" name="default" value="{$info.name|default=''}" jq-verify="" jq-error=" 默认的内容" placeholder="默认的内容" class="layui-input ">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">字段顺序</label>
                        <div class="layui-input-inline">
                            <input type="text" name="sequence"  jq-verify="number" value="{$info.sequence|default='0'}" jq-error="排序必须为数字" placeholder="分类排序" class="layui-input ">
                        </div>
                    </div>
                    <div class="layui-form-item" pane>
                        <label class="layui-form-label">后台列表显示</label>
                        <div class="layui-input-inline">
                            <input type="radio" name="show" {eq name="info.show" value="1"}checked{/eq} title="开启" value="1" checked />
                            <input type="radio" name="show" {eq name="info.show" value="2"}checked{/eq} title="关闭" value="2" />
                        </div>
                    </div>
                    <div class="layui-form-item" pane>
                        <label class="layui-form-label">前台录入</label>
                        <div class="layui-input-inline">
                            <input type="radio" name="post" {eq name="info.post" value="1"}checked{/eq} title="开启" value="1" checked />
                            <input type="radio" name="post" {eq name="info.post" value="2"}checked{/eq} title="关闭" value="2" />
                        </div>
                    </div>
                    <div class="layui-form-item" pane>
                        <label class="layui-form-label">后台搜索</label>
                        <div class="layui-input-inline">
                            <input type="radio" name="search" {eq name="info.search" value="1"}checked{/eq} title="开启" value="1" checked />
                            <input type="radio" name="search" {eq name="info.search" value="2"}checked{/eq} title="关闭" value="2" />
                        </div>
                    </div>

                    <div class="layui-input-block">
                        <input type="hidden" name="fieldset_id" type="hidden" value="{$fieldsetInfo.fieldset_id|default=''}">
                        <input type="hidden" name="field_id" type="hidden" value="{$info.field_id|default=''}">
                        <button class="layui-btn" jq-submit lay-filter="submit" jq-tab="true">立即提交</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </form>
            </section>
        </div>
    </div>
</div>
</body>
{/block}
{block name="script"}
<script>
    layui.use('myform', function(){
        var $ = layui.jquery,
                form = layui.jqform;
        //各种基于事件的操作，下面会有进一步介绍
        //自定义
        form.verify({
            field:function (value) {
                if (value==''){
                    return '字段名不能为空';
                }
                if (!new RegExp("^[a-zA-Z0-9_\u4e00-\u9fa5\\s·]+$").test(value)) {
                    return '字段名不能有特殊字符';
                }
                if (/(^\_)|(\__)|(\_+$)/.test(value)) {
                    return '字段名首尾不能出现下划线\'_\'';
                }
                if(/.*[\u4e00-\u9fa5]+.*$/.test(value)){
                    return '字段名不能含有汉字！';
                }

            }
        });
    });
</script>
{/block}